package com.bai.shopping.product.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement//开启事务功能
@MapperScan("com.bai.shopping.product.dao")
public class MybatisConfig {
    /**
     * 添加分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        //设置分页大于最后页面的操作；true返回首页，false继续
        paginationInterceptor.setOverflow(true);
        //设置限制最大单页记录数；默认500，-1不受限制
        paginationInterceptor.setLimit(1000);
        return paginationInterceptor;
    }
}
